package com.samebuilding.service.impl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.samebuilding.dao.ActivityBigTypeDAO;
import com.samebuilding.dao.ActivitySmallTypeDAO;
import com.samebuilding.domain.ActivityBigtype;
import com.samebuilding.domain.ActivitySmalltype;
import com.samebuilding.service.ActivityTypeService;

public class ActivityTypeServiceImpl implements ActivityTypeService {

	private ActivityBigTypeDAO activityBigTypeDAO;
	private ActivitySmallTypeDAO activitySmallTypeDAO;
	
	
	
	
	public ActivityBigTypeDAO getActivityBigTypeDAO() {
		return activityBigTypeDAO;
	}

	public void setActivityBigTypeDAO(ActivityBigTypeDAO activityBigTypeDAO) {
		this.activityBigTypeDAO = activityBigTypeDAO;
	}

	public ActivitySmallTypeDAO getActivitySmallTypeDAO() {
		return activitySmallTypeDAO;
	}

	public void setActivitySmallTypeDAO(ActivitySmallTypeDAO activitySmallTypeDAO) {
		this.activitySmallTypeDAO = activitySmallTypeDAO;
	}

	
	@Transactional
	public void addActivityBigType(ActivityBigtype bigType) {
		this.activityBigTypeDAO.save(bigType);

	}

	
	@Transactional
	public void addActivitySmallType(ActivitySmalltype smallType) {
		this.activitySmallTypeDAO.save(smallType);

	}

	
	@Transactional
	public void deleteActivityBigType(ActivityBigtype bigType) {
		this.activityBigTypeDAO.delete(bigType);

	}

	@Transactional
	public void deleteActivityBigType(int bigTypeId) {
		this.activityBigTypeDAO.delete(bigTypeId);

	}

	@Transactional
	public void deleteActivitySmallType(ActivitySmalltype smallType) {
		this.activitySmallTypeDAO.delete(smallType);

	}

	@Transactional
	public void deleteActivitySmallType(int smallTypeId) {
		this.activitySmallTypeDAO.delete(smallTypeId);

	}

	public List<ActivityBigtype> findAllBigType() {
		
		return this.activityBigTypeDAO.findAll();
	}

	public List<ActivitySmalltype> findAllSmallType() {
		
		return this.activitySmallTypeDAO.findAll();
	}

	public List<ActivitySmalltype> findByBigType(int bigTypeId) {
		
		return this.activitySmallTypeDAO.findByBigType(bigTypeId);
	}

	public ActivityBigtype getBigTypeById(int bigtypeId) {
		return this.activityBigTypeDAO.findById(bigtypeId, true);
	}

	public ActivitySmalltype getSmallTypeById(int smalltypeId) {
		return this.activitySmallTypeDAO.findById(smalltypeId, true);
	}

}
